In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
The Lord Mayor of Bytetown plans to locate a number of radar speed cameras in the city. There are intersections in Bytetown numbered from 1 to , and two way street segments. Each of these street segments stretches between two intersections. The street network allows getting from each intersection to any other.
The speed cameras are to be located at the intersections (maximum one per intersection), wherein The Lord Mayor wants to maximise the number of speed cameras. However, in order not to aggravate Byteland motorists too much, he decided that on every route running across Bytetown roads that does not pass through any intersection twice there can be maximum speed cameras (including those on endpoints of the route). Your task is to write a program which will determine where the speed cameras should be located.
The first line of input contains two integers and (): the number of intersections in Bytetown and maximum number of speed cameras which can be set up on an individual route. The lines that follow describe Bytetown street network: the -th line contains two integers and (), meaning that there is a two-way street segment which joins two intersections numbered and .
The first output line should produce : the number describing the maximum number of speed cameras, that can be set up in Byteland. The second line should produce a sequence of numbers describing the intersections where the speed cameras should be constructed. Should there be many solutions, your program may output any one of them.
For the following input data:
5 2 1 3 2 3 3 4 4 5
one of the correct results is:
3 1 2 4
Task author: Tomasz Idziaszek